<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%
	String hospitalNotesJson= (String)request.getAttribute("hospitalNotesJson");
	String pageJson= (String)request.getAttribute("pageJson");
	

	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
	request.setAttribute("basePath", basePath);

 %>
 <style>
 .tdLabel_5:hover{
  background:#f5f5f5;
 }
 </style>
<!--内容部分-->
   
<div class="list_NR">
    <div class="loc">
        <h3>病案修改留痕</h3>
        <!-- <ul class="loc_loc">
          	  病案管理>病案版本
        </ul> -->
    </div>
    <div class="list_con_table">
       <div class="search_table">
           <ul class="clearfix" style="margin-bottom:0;">
               <li class="Label_1" style="width:11%">出院日期：&nbsp;</li>
               <li class="Label_2" style="width:27%;" id="outHospitalDate"></li>
               <li class="Label_1" style="width:11%">ID号：&nbsp;</li>
               <li class="Label_2" id="mrId"></li>
               <li class="Label_1" style="width:11%">患者姓名：&nbsp;</li>
               <li class="Label_2" id="name"></li>
               <li class="Label_1" style="width:11%">身份证号：&nbsp;</li>
               <li class="Label_2" style="width:27%;" id="idCard"></li>
               
               <li class="Label_1" style="width:11%">出院科室：&nbsp;</li>
               <li class="Label_2" id="officeName"></li>
               <li class="Label_1" style="width:11%">病案号：&nbsp;</li>
               <li class="Label_2" id="onlyId"></li>
              <!--  <li class="Label_1" style="width:11%;">离院方式：&nbsp;</li>
               <li class="Label_2" id="outHospitalTypeName"></li> -->
            </ul>
        </div>
     </form>

   </div>

   <table class="Search_tableList"cellpadding="0" cellspacing="0">

       <tr>
           <td class="tdLabel_4">留痕版本</td>
           <td class="tdLabel_4">修改者</td>
           <td class="tdLabel_4">留痕时间</td>

           <td class="tdLabel_4">操作</td>
       </tr>
       <tbody id="tbody">
       <!-- <tr>
           <td class="tdLabel_5">版本一</td>
           <td class="tdLabel_5"><a target='_blank' class="int" href=''>图片</a><a target='_blank' class="int" href=''>首页</a></td>
       </tr> -->
      </tbody> 
    </table>
    
</div>
<!--script JS部分-->
<script type="text/javascript" src="${basePath}/static/publics/assets/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}/static/publics/assets/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="${basePath}/static/publics/assets/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${basePath}/static/publics/assets/jqPaginator/jqPaginator.js"></script>
<script type="text/javascript">
	//获取guid
	var urlObj=GetRequest();
	var firstGuid=urlObj.firstGuid;
	//console.log(firstGuid)
   init();
   function init(){
	  $.ajax({
		   type:"post",
		   url:"${basePath}/hospitalNoteVersion/findHopitalNoteVersionListByFirstGuid",
		   data:{firstGuid:firstGuid},
		   success:function(data){
			   console.log(data)
			   if(data.success){
				   if(data.data!=null){
					   var firstLevleMedical=data.data.firstLevleMedical;
					   var outHospitalDate=firstLevleMedical.outHospitalDate?firstLevleMedical.outHospitalDate:"";
					   var mrId=firstLevleMedical.mrId?firstLevleMedical.mrId:"";
					   var name=firstLevleMedical.name?firstLevleMedical.name:"";
					   var idCard=firstLevleMedical.idCard?firstLevleMedical.idCard:"";
					   var officeName=firstLevleMedical.officeName?firstLevleMedical.officeName:"";
					   var onlyId=firstLevleMedical.onlyId?firstLevleMedical.onlyId:"";
					   var outHospitalTypeName=firstLevleMedical.outHospitalTypeName?firstLevleMedical.outHospitalTypeName:"";
					       
					   $("#outHospitalDate").text(outHospitalDate);
					   $("#mrId").text(mrId);
					   $("#name").text(name);
					   $("#idCard").text(idCard);
					   $("#officeName").text(officeName);
					   $("#onlyId").text(onlyId);
					   $("#outHospitalTypeName").text(outHospitalTypeName);
					   
					   //版本
					   var hospitalNoteVersionList=data.data.hospitalNoteVersionList;
					   if(hospitalNoteVersionList.length>0){
						   var html="";
						   $.each(hospitalNoteVersionList,function(i,item){
							   html+='<tr>'+
							   		 '<td class="tdLabel_5">版本'+(i+1)+'</td>'+
							   		 '<td class="tdLabel_5">'+(item.operator==undefined?'':item.operator)+'</td>'+
							   		 '<td class="tdLabel_5">'+item.create_time+'</td>'+
					                 '<td class="tdLabel_5"><a class="int" fileName='+item.file_name+' firstGuid='+item.first_guid+' onclick="scan(this)">查看版本数据信息</a></td>'+
					                 '</tr>';
						   })
						   $("#tbody").html("").html(html)
					   }
				   }
			   }
		   }
	   })
   }
   
   //查看图片
 /*    function pic(e){
	   var guid=$(e).closest("tr").attr("data-guid");
	   window.open('${basePath}/medrecord/showMedrecordImageHistoryVersion?guid='+guid)
   } */
   //查看首页
   function scan(obj){
	   var firstGuid=$(obj).attr("firstGuid");
	   var fileName=$(obj).attr("fileName");
	
	  // location.href="${basePath}/medical_record/searchHomePageIndexForm?visitGuid="+firstGuid+"&fileName="+fileName+"";
	   
	 //  alert(fileName);
   		
	   //var guid=$(e).closest("tr").attr("data-guid");
	   window.open('${basePath}/medical_record/searchHomePageIndexForm?visitGuid='+firstGuid+'&fileName='+fileName+'');
   }
   //获取路径上参数
   function GetRequest() {   
	   var url = location.search; //获取url中"?"符后的字串   
	   var theRequest = new Object();   
	   if (url.indexOf("?") != -1) {   
	      var str = url.substr(1);   
	      strs = str.split("&");   
	      for(var i = 0; i < strs.length; i ++) {   
	         theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);   
	      }   
	   }   
	   return theRequest;   
	}
   
</script>
